home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / basic / qlib.exe / SYSTEM.DOC < prev    next >
Text File  |  1992-04-22  |  16KB  |  515 lines

  1.      QLIB's SYSTEM routines detect the presence or status of PC hardware
  2.      or software.  Monitor type, co-processor presence, CPU speed and keyboard
  3.      toggles may be determined, CPU speed toggle and keyboard toggles may be
  4.      set.  CTRL, ALT and SHIFT key status may also be monitored, and the
  5.      software enviornment may be determined.
  6.  
  7.  
  8.  
  9.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  10.  
  11.      Subroutines: CapsOFF, CapsON
  12.      object file: kbd2.obj
  13.  
  14.           Simplified controls to toggle the CapsLock key.  See also
  15.      GetKBDToggle and SetKBDToggle.
  16.  
  17.      Example:
  18.           CALL CapsON         ' this turns Caps Lock on
  19.  
  20.  
  21.  
  22.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  23.  
  24.     Function: oops% = DOSError
  25.     object file: q$error.obj
  26.  
  27.     DOSError returns an error flag resulting from the most recent QLIB
  28.     subroutine which updates the DOS error flag (see FLoad in DISK.DOC).
  29.     NOTE: not all QLIB subroutines update DOSError!!
  30.  
  31.     common MS-DOS error codes are:
  32.  
  33.     2 = file not found
  34.     3 = path not found
  35.     4 = too many open files
  36.     5 = access denied (file may be read-only or a subdirectory
  37.                        or subdirectory not empty)
  38.     8 = insufficient memory
  39.     19= disk is write-protected
  40.  
  41.     Example:
  42.      REM $INCLUDE: '\qb4\qlib.bi'
  43.      filename$ = "\ramfont\italics.fnt" + CHR$(0)
  44.      iseg% = fload (filename$)
  45.      IF DOSError THEN
  46.          .
  47.          .
  48.          .              ; error handling code
  49.  
  50.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  51.  
  52.     Subroutine: EGAinfo(crt%, memory%)
  53.     object file: egainfo.obj
  54.  
  55.          EGAinfo determines the type of monitor and amount of memory
  56.     installed on an EGA card.  Crt% = 0 if a monochrome monitor is
  57.     attached to the EGA card, -1 if an RGB color monitor, and crt% = 1
  58.     if the monitor is an Enhanced or Mutli-scan monitor.  Memory% returns
  59.     the kbytes installed on the card.  If no EGA is installed, memory% = 0.
  60.  
  61.     Example:
  62.          CALL EGAinfo(crt%, memory%)
  63.  
  64.  
  65.  
  66.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  67.  
  68.     Function: a$ = EXEName$()
  69.     object files: exename.obj (strncpy.obj)
  70.  
  71.     requires DOS version 3.0 or later
  72.  
  73.          EXEName$ returns the full drive and path name of the currently
  74.     executing program.  When developing programs within the QB or QBX
  75.     development enviornment, EXEName$ returns something like:
  76.  
  77.     C:\QB4\QB.EXE
  78.  
  79.     Example:
  80.     REM $INCLUDE: 'qb4\lib\qlib.bi'
  81.     PRINT EXEName$                   ' prints name of program
  82.  
  83.  
  84.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  85.  
  86.     Subroutine: FindMONO(crt%)
  87.     object files: findmono.obj (find6845.obj, egainfo.obj, q$herc.obj)
  88.  
  89.          FindMONO determines if a monochrome monitor is installed.
  90.     GetCRT (below) determines the default monitor; FindMONO will
  91.     find an MDA or HGC monitor in single- or dual-monitor setups
  92.     whether the monochrome monitor is default or not.  Crt% = 0 if
  93.     MDA, 128 or greater if HGC or compatible, and -1 if no monochrome
  94.     installed.
  95.  
  96.     Example:
  97.          CALL FindMONO(crt%)
  98.  
  99.  
  100.  
  101.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  102.  
  103.     Function: Floppies
  104.     object file: floppies.obj
  105.  
  106.          FLOPPIES determines the number of floppy drives installed in the
  107.     computer.
  108.  
  109.     Example:
  110.          REM $INCLUDE: 'qlib.bi'
  111.          fdrives = floppies            ' get number of floppy drives
  112.  
  113.  
  114.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  115.  
  116.     Subroutine: GetCPU(cpu%)
  117.     object file: getcpu.obj
  118.  
  119.          Determines the processor in the computer system.  Returns cpu% = 0
  120.     if 8086 or 8088, cpu% = 1 if 80186 or 80188, cpu% = 2 if 286 and
  121.     cpu% = 3 if 386 or 386sx, and cpu% = 4 if 486.
  122.  
  123.     Example:
  124.          CALL GetCPU(cpu%)
  125.          SELECT CASE cpu%
  126.               CASE 0
  127.                 cpu$ = "8086 or 8088"
  128.               CASE 1
  129.                 cpu$ = "80186 or 80188"
  130.               CASE 2
  131.                 cpu$ = "286"
  132.               CASE 3
  133.                 cpu$ = "386"
  134.          END SELECT
  135.  
  136.  
  137.  
  138.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  139.  
  140.     Subroutine: GetCRT(crt%)
  141.     object files: getcrt.obj (q$herc.obj, egainfo.obj)
  142.  
  143.          GetCRT tells you what kind of display is being used.  The returned
  144.     value will be zero if it's MDA or EGA with a monochrome monitor, -1 if
  145.     CGA, 1 if EGA with a color or enhanced color monitor, 2 if MCGA, and if
  146.     VGA, crt% will be 3.  With Hercules or Hercules clones, crt% will be 128
  147.     or greater.  The Hercules Graphics Card Plus returns 144, and the 
  148.     Hercules InColor card returns 208.  See also IsSEVGA, EGAinfo, and
  149.     FindMONO.
  150.  
  151.     Example:
  152.          REM $INCLUDE: 'qlib.bi'
  153.          CALL GetCRT(crt%)
  154.          SELECT CASE crt%
  155.               CASE -1
  156.                    PRINT "CGA Color"
  157.               CASE 0
  158.                    PRINT "Monochrome Display Adapter"
  159.               CASE 1
  160.                    PRINT "EGA"
  161.               CASE 2
  162.                    PRINT "MCGA"
  163.               CASE 3
  164.                    PRINT "VGA"
  165.               CASE 128 TO 208
  166.                    PRINT "Hercules"
  167.          END SELECT
  168.  
  169.  
  170.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  171.  
  172.     Subroutine: GetDOSVer(maj%, min%)
  173.     object file: dosver.obj
  174.  
  175.          GetDOSVer returns the major and minor version numbers of the DOS
  176.     installed.  Maj% is the major version number, i.e., maj% = 3 if DOS 3.xx
  177.     is installed.  Min% is the minor version number, i.e., min% = 21 if DOS
  178.     x.21 is installed.
  179.  
  180.     Example:
  181.      CALL GetDOSVer(maj%,min%)
  182.      REM if maj% < 3 then SHELL may not be reliable
  183.  
  184.  
  185.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  186.  
  187.     Subroutine: GetKBDToggle(kbd%)
  188.     object file: kbd.obj
  189.  
  190.          Returns the status of the keyboard toggles and whether the CTRL, ALT
  191.     or SHIFT keys are pressed.  The code returned by GetKBDToggle is a copy of
  192.     the BIOS keyboard status byte, which must be ANDed to determine which key
  193.     toggles are set.  See also SetKBDToggle.
  194.  
  195.     Example:
  196.          rshift% = 1
  197.          lshift% = 2
  198.          shiftkey% = 3
  199.          ctrl% = 4
  200.          alt% = 8
  201.          scroll% = 16
  202.          numb% = 32
  203.          caps% = 64
  204.          insert% = 128
  205.          
  206.          CALL GetKBDToggle(kbd%)
  207.          IF (kbd% AND rshift%) THEN PRINT "Right Shift pressed"
  208.          IF (kbd% AND lshift%) THEN PRINT "Left Shift pressed"
  209.          IF (kbd% AND shiftkey%) THEN PRINT "Shift Key pressed"
  210.          IF (kbd% AND ctrl%) THEN PRINT "Ctrl Key pressed"
  211.          IF (kbd% AND alt%) THEN PRINT "Alt Key pressed"
  212.          IF (kbd% AND scroll%) THEN PRINT "ScrollLOCK ON"
  213.          IF (kbd% AND numb%) THEN PRINT "NumLOCK ON"
  214.          IF (kbd% AND caps%) THEN PRINT "CapsLOCK ON"
  215.          IF (kbd% AND insert%) THEN PRINT "INSERT ON"
  216.  
  217.  
  218.  
  219.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  220.  
  221.     Subroutine: GetSpeed(speed%)
  222.     object file: speed.obj
  223.  
  224.          Determines whether the system is in "turbo" mode.  Returns 0 if
  225.     CPU is operating at normal speed, 1 if operating at faster CPU speed.
  226.     See also SetSpeed.
  227.  
  228.     Example:
  229.          CALL GetSpeed(speed%)
  230.  
  231.  
  232.  ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  233.  
  234.      Function: IsSEVGA
  235.      object file: issevga.obj
  236.  
  237.           IsSEVGA determines if a Super EGA or Super VGA graphics
  238.      card is installed.  Systems detected are:
  239.  
  240.      Everex Micro Enhancer EGA
  241.      Paradise EGA 480
  242.      Oak VGA
  243.      Paradise Plus 16 VGA
  244.      Tseng VGA
  245.      Western Digital VGA
  246.  
  247.      Note that IsSEVGA does not determine what kind of monitor is
  248.      connected to the card.  Many Super EGA/VGA cards require a
  249.      multi-frequency monitor to take advantage of the card's extended
  250.      capabilities.
  251.  
  252.      IsSEVGA returns 0 if no s